<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>

<%
	request.setAttribute("title","文件详情");
	request.setAttribute("modelConfigPath", "document");
%>

<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/index.jsp" %>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/uploaders/uploaders.jsp"%>
<style type="text/css">

</style>

<t:panel cssClass="panel-flat form-detailed form-xs" customBody="true" customHead="true">
	<div class="detailed-navbar-content panel-body">
		<t:form commandName="reportCataLog" action="/admin/document/reportCataLog/save" method="post" cssClass="form-horizontal">
			<div class="hide">
				<t:hidden path="id"/>
			</div>
			<t:formgroup>
				<div style="height:40px;margin:4px 0px">
					<t:label path="createUserName" cssClass="col-sm-2"/>
					<t:input path="createUserName" colClass="col-sm-4" readonly="true" />
		
					<t:label path="reportType" cssClass="col-sm-2" />
					<t:select2 path="reportType" colClass="col-sm-4"/>
				</div>
			</t:formgroup>
			<t:formgroup>
				<div style="height:40px;margin:4px 0px">
					<t:label path="fileName" cssClass="col-sm-2" />
					<t:input path="fileName" colClass="col-sm-8"/>
					<t:input path="UUID" style="display:none"/>
					<t:button icon="icon-floppy-disk" onclick="startUpload()" cssClass="btn-info" csize="sm">上传</t:button>
				</div>
			</t:formgroup>
			<t:formgroup>
				<div style = "height:40px;margin:4px 4px">
					<t:label path="shareIds" cssClass="col-sm-2"/>
					<t:select2 path="shareIds" multiple="true" colClass="col-sm-10"/>
				</div>
			</t:formgroup>
					
		</t:form>
	</div>
	<t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()" cssClass="btn-info" csize="sm">保存</t:button>
	</t:panelFoot>
</t:panel>


<script type="text/javascript">
	function saveData(){
		if (!$("form:first").valid()){
			return;
		}
		$("form:first").submit();
	}
	
	function startUpload(){
		var that=this;
		$(document).startOssFileUpload({
			FileUploaded:function(up, file, info){
				fileUploader(up,file,info);
			}
		})
	}
	
	function fileUploader(up,file,info){
		if(info.status!=200){
			return;
		}
		var responseJson=JSON.parse(info.response)
		if(responseJson.Status!="OK"){
			return;
		}
		var ossId=responseJson.id;
		var showName=file.name;
		$("#UUID").val(ossId);
		$("#fileName").val(showName);
	}
	
	
</script>

<%@ include file="/WEB-INF/views/shared/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>